<template>
    <div>
        <mt-header fixed title="主页"></mt-header>
        <p>{{count}}</p>
        <p>{{doneCount}}</p>
        <mt-button type="primary" @click="mtButtonClick">primary</mt-button>
    </div>
</template>
<script>
    import { mapGetters } from 'vuex'
    import { mapState } from 'vuex'
    import { mapMutations } from 'vuex'
    import { mapActions } from 'vuex'

    export default {
        data () {
            return {
                title: '主页'
            }
        },
        computed:{
            ...mapState({
                 count: state => state.count
            }),
            ...mapGetters({
                    doneCount: 'doneTodosCount'
            })
        },
        methods:{
            ...mapMutations([
                'increment' ,// 映射 this.increment() 为 this.$store.commit('increment'
            ]),
            ...mapActions([
                 'increment' // 映射 this.increment() 为 this.$store.dispatch('increment')
            ]),
            mtButtonClick(){
                this.increment();
            }
        }

    }
</script>
<style>
</style>
